package langnstats.project;

import java.io.File;
import java.io.IOException;

import langnstats.project.languagemodel.interpolation.LinearInterpolation;
import langnstats.project.languagemodel.srilm.NGramLanguageModel;
import langnstats.project.languagemodel.srilm.SriLMParameters.DiscountingMethod;
import langnstats.project.lib.LanguageModel;
import langnstats.project.lib.WordType;
import langnstats.project.lib.crossvalidation.TrainTokens;

public class Trainer {
	
	
	public static void main(String[] args) throws IOException{
		if(args.length<2){ throw new IllegalArgumentException("There must be more than 2 arguments! Current argument # = " + args.length); }
		File trainFile = new File(args[0]);
		
		/* TODO */
		int[] discount = new int[3];
		int[] cutoff = new int[3];
		cutoff[0] = 0;
		cutoff[1] = 1;
		cutoff[2] = 2;
		discount[0] = discount[1] = discount[2] = 7;
		

		LanguageModel model = new LinearInterpolation();
		
		WordType[] tokens = WordType.parse(trainFile);
		TrainTokens tt = new TrainTokens(tokens);
		model.train( tt );
		File modelFile = new File(args[1]);
		Global.save(model, modelFile);		
	}

}
